package yxy.cherry.battle.module.affix.skill;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.AffixContext;
import yxy.cherry.battle.module.affix.AffixFactory.SkillTypeEnum;
import yxy.cherry.battle.module.affix.Skill;
import yxy.cherry.battle.module.affix.SkillType;
import yxy.cherry.battle.module.record.stream.RecordStream42TriggerSkill;
import yxy.cherry.data.bean.skill;

import java.util.ArrayList;

/** 反击 */
@SkillType(Type = SkillTypeEnum.反击)
public class Affix_07_反击 extends Skill {

	private int get伤害比例() {
		return getParam(0);
	}

	public Affix_07_反击(Fighter actor, skill skilldata, int probability, int[] params) {
		super(actor, skilldata, probability, params);
	}

	@Override
	public boolean exec(Fighter actor, Fighter target) {
		if (getAffixContext().is附加行动中()) {
			return false;
		}
		ArrayList<Fighter> sources = new ArrayList<>();
		sources.add(getAffixAction().get行动者());
		ArrayList<Fighter> targets = new ArrayList<>();
		targets.add(actor);

		AffixContext.AffixAction action = getAffixContext().add附加行动(getActor(), sources, AffixContext.AffixActionClass.反击);
		action.set附加比例(get伤害比例());
		getRecord().stream(new RecordStream42TriggerSkill(getActor(),502)).record();

		Battle.battleLogger(6,"反击：反击者："+getActor()+"伤害比例："+get伤害比例());

		return true;
	}
}